<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link href="/godance/layui/src/css/layui.css" rel="stylesheet">
  <script src="/godance/layui/src/layui.js"></script>
  <script src="/godance/js/jquery-3.4.1.js"></script>
  <script src="/godance/js/My_js.js"></script>
  <script type="text/javascript">
    // 表单,依赖 form 模块
    layui.use('form', function() {
      var form = layui.form;
    })
  </script>
</head>
<body>
<form action="" class="layui-form">
  <br/>
  <!-- 基本的行区块结构，它提供了响应式的支持。-->
  <div class="layui-form-item">  <!--这一行-->
    <label class="layui-form-label">收藏夹名</label>  <!--区 -->
    <div class="layui-input-inline">  <!--块 -->
      <!-- 输入框 -->
      <input id="coll_name1" type="text" name="title" required lay-verify="required" placeholder="请输入收藏夹的名字" autocomplete="off" class="layui-input" />
    </div>
    <label class="layui-form-label">标题</label>  <!--区 -->
    <div class="layui-input-inline">  <!--块 -->
      <!-- 输入框 -->
      <input id="child_title1" type="text" name="web_name" required lay-verify="required" placeholder="请输入存放的网页名称" autocomplete="off" class="layui-input" />
    </div>
    <button id="btn_delete_child" class="layui-btn layui-btn-normal">确认</button>
  </div>
</form>
</body>
</html>

<script type="text/javascript">
  $(function () {
    $("#btn_delete_child").click(function () {
      var token = localStorage.getItem('token');
      $.ajax({
        url:"delete_one_child",
        headers:{
          "Authorization": "Bearer "+token
        },
        data:{
          "name":$("#coll_name1").val(),
          "title":$("#child_title1").val(),
        },
        dataType:"json",
        type:"post",
        success:function (result) {
          if (result.code==200){
            alert("删除成功")
          }else if(result.code==404){
            alert("不存在该收藏夹")
          }else if(result.code==405){
            alert("不存在该收藏内容")
          }else {
            alert("未登录 请登录")
          }
        }
      })
    })
  })
</script>